package com.ymatou.iapi.login.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.login.parameter.ThirdpartyLoginBean;
import com.ymatou.iapi.login.parameter.GetAliUserInfoBean;
import com.ymatou.iapi.login.service.ThirdpartyLoginCall;
import com.ymatou.iapi.login.service.GetAliUserInfoCall;
import com.ymatou.iapi.login.service.GetAliUserInfoCall;
import com.ymatou.iapi.login.service.LoginAuthCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.constant.ECode;
import com.ymttest.utils.constant.ThirdPartyType;
/**
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetAliUserInfo{
	private static GetAliUserInfoBean GetAliUserInfoBean;
	private static GetAliUserInfoCall GetAliUserInfoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取支付宝用户信息");
	}

	@Before
	public void caseUp() {
		GetAliUserInfoBean=new GetAliUserInfoBean();
		GetAliUserInfoCall=new GetAliUserInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(GetAliUserInfoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	//需要正确的支付宝授权码
	public void Tc_GetAliUserInfo_001() {
		Logger.start(true,"获取支付宝用户信息");
		try {
			GetAliUserInfoBean.setAppId("autotest");
			GetAliUserInfoBean.setRequestId(TestDataManager.getRandomUUID().toString());
			GetAliUserInfoBean.setAuthCode("test");
			GetAliUserInfoCall.setData(GetAliUserInfoBean);
			GetAliUserInfoCall.callService();
			Map returndata = GetAliUserInfoCall.getMap();
			Logger.debug(returndata);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetAliUserInfo_002() {
		Logger.start(false,"不输入授权码失败");
		try {
			GetAliUserInfoBean.setAppId("autotest");
			GetAliUserInfoBean.setRequestId(TestDataManager.getRandomUUID().toString());
			GetAliUserInfoCall.setData(GetAliUserInfoBean);
			GetAliUserInfoCall.callService();
			Logger.verifyEquals("false", GetAliUserInfoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("400", GetAliUserInfoCall.getString("ErrorCode"), "验证ErrorCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}